#region (c) 2014 THN Solutions LLC. - All rights reserved
/*
THN DATA ABSTRACTION LAYER version 1

Copyright (c) 2014, THN Solutions LLC. ( www.ThnSolutions.com )
Author: Nguyễn, M. Hải                 ( www.Minh-Hai.com     )
All rights reserved.

This library is dual-licensed.
  + For commercial software, please obtain a commercial license from THN Solutions LLC.

  + For free software, this library is licensed under GPL version 3. A summary of GPLv3 is
    listed below. You should also find a copy of GPLv3 as file License_GPLv3.txt included
	with the source-code files.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 3 as published by
    the Free Software Foundation  of the License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#endregion

#region Using directives
using System;
#endregion

namespace Thn.Data.Mapping
{
    /// <summary>
    /// A data descriptor provides mapping information for data objects
    /// </summary>
    public interface IDataMapper
    {

        /// <summary>
        /// Gets the mapping for an oject type
        /// </summary>
        ObjectMap GetEntity(Type objectEntity);
        
        /// <summary>
        /// Gets savable attribute(fields, properties) for a given object type
        /// </summary>
        AttributeMap[] GetAttributes(Type objectEntity);

        /// <summary>
        /// Gets an attribute map by name
        /// </summary>
        /// <param name="objectEntity">type of object</param>
        /// <param name="name">name of object attribute</param>
        AttributeMap GetAttribute(Type objectEntity, string name);

        /// <summary>
        /// Gets the identifier attribute(s) for a given object type
        /// </summary>
        AttributeMap[] GetIdentifiers(Type objectEntity);

        /// <summary>
        /// Assign value to object's attribute
        /// </summary>
        /// <param name="target">object to set</param>
        /// <param name="attribute">name of object's attribute</param>
        /// <param name="value">value to set</param>
        void SetObjectAttributeValue(object target, string attribute, object value);

        /// <summary>
        /// Assign value to object's attribute
        /// </summary>
        /// <param name="target">object to set</param>
        /// <param name="attribute">attribute map to assign value</param>
        /// <param name="value">value to set</param>
        void SetObjectAttributeValue(object target, AttributeMap attribute, object value);

        /// <summary>
        /// Get value from object's attribute and return (in data attribute type) value
        /// </summary>
        /// <param name="target">object to obtain value from</param>
        /// <param name="attribute">name of object's attribute</param>
        /// <returns>value in data attribute's type</returns>
        object GetObjectAttributeValue(object target, string attribute);

        /// <summary>
        /// Get value from object's attribute
        /// </summary>
        /// <param name="target">object to obtain value from</param>
        /// <param name="attribute">attribute map to obtain value</param>
        object GetObjectAttributeValue(object target, AttributeMap attribute);
    }
}
